<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .gray {
            color: gray;
        }
        .black {
            color: black;
        }
        .box {
            width: 200px;
            height: 400px;
        }
        #input {
            background-color: white;
        }
        .list {
            display: block;
            list-style: none;
            width: 200px;
            height: 300px;
        }
    </style>
</head>
<body>
    <input type="button" value="选择" id="btn">
    <select name="" id="food">
        <option>螺蛳粉</option>
        <option>铜锣烧</option>
        <option>火锅</option>
        <option>烤肉</option>
        <option>日料</option>
        <option>自助餐</option>
        <option>米粉</option>
    </select>
    <script>
        var btn = document.getElementById("btn")
        var food = document.getElementById("food")
        var opts = food.getElementsByTagName("option")
        console.log(opts)
        
        btn.onclick = function() {
            var n = Math.floor(Math.random()* opts.length)
             opts[n].selected = true;
        }
    </script>
</body>
</html>